package com.itheima.goods.controller;

import com.itheima.goods.entity.GoodsEntity;
import com.itheima.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/findGoodsInfoById/{goodsId}")
    public GoodsEntity findGoodsInfoById(@PathVariable("goodsId") Long goodsId){
        return goodsService.findGoodsInfoById(goodsId);
    }

    //修改
    @RequestMapping("/updateInfo/{goodsId}")
    public GoodsEntity updateInfo(@PathVariable("goodsId") Long goodsId, @RequestBody GoodsEntity goodsEntity){
        return goodsService.updateInfo(goodsId,goodsEntity);
    }
}
